package com.shansun.util
{
	public class DateUtils
	{
		public function DateUtils()
		{
		}
		
		public static function convertStrToDate(dateString:String):Date {
		    if ( dateString == null ) {
		        return null;
		    }
		
		    var year:int = int(dateString.substr(0,4));
		    var month:int = int(dateString.substr(5,2))-1;
		    var day:int = int(dateString.substr(8,2));
		
		    if ( year == 0 && month == 0 && day == 0 ) {
		        return null;
		    }
		
		    if ( dateString.length == 10 ) {
		        return new Date(year, month, day);
		    }
		
		    var hour:int = int(dateString.substr(11,2));
		    var minute:int = int(dateString.substr(14,2));
		    var second:int = int(dateString.substr(17,2));
		
		    return new Date(year, month, day, hour, minute, second);
		}
	}
}